<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <ui:composition template="/template/DefaultTemplate.xhtml">
         
        <ui:define name="content">
             <br />
            
            <p:panel header="Completed Goods Management" id="GoodsManagement" toggleable="true">
                <h:form prependId="false">
                    <h:panelGroup id="messagePanel" layout="block">
                        <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
                    </h:panelGroup>
                   
                    <h:panelGroup >
                        <p:dataTable value="#{completedGoodsEntityController.completedGoodsList}" var="item" 
                                       style="text-align: center"
                                     paginator="true" rows="23"  
                                     paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                                     rowsPerPageTemplate="5,10,15"
                                     >
                                     
                            <p:column filterBy="#{item.productName}">
                                <f:facet name="header">
                                    <h:outputText value="Product Name"/>
                                </f:facet>
                                <h:outputText value="#{item.productName}"/>
                            </p:column>      
                            
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="&nbsp;"/>
                                </f:facet>
                                <p:menuButton value="Options" >
                                     <p:menuitem value=" View" ajax="false" icon="ui-icon ui-icon-search" 
                                                action="#{completedGoodsEntityController.viewThisGood(item)}" rendered="#{item.archived==false and loginBacking.viewCompletedGood}"/>  
                               
                                     
                                     <p:menuitem value=" Edit" ajax="false" rendered="#{item.archived==false and loginBacking.editCompletedGood}" icon="ui-icon ui-icon-disk" 
                                                action="#{completedGoodsEntityController.prepareEdit(item)}"/> 
                                    
                                     <p:menuitem value=" Delete" ajax="false" rendered="#{item.archived==false and loginBacking.deleteCompletedGood}" icon="ui-icon ui-icon-close"
                                                action="#{completedGoodsEntityController.destroy(item)}"/> 
                                </p:menuButton>
                                
                            </p:column>
                           
                        </p:dataTable>   
                    </h:panelGroup>
                    <br />
                </h:form>
            </p:panel>
            <h:form>
            <p:commandButton rendered="#{loginBacking.createNewCompletedGood}" action="#{completedGoodsEntityController.prepareCreate}" ajax="false" value="Create New Completed Good"/>

            </h:form>
        </ui:define>
    </ui:composition>

</html>
